package week6;

import java.util.Scanner;

public class StringStudy1 {
    public static void main(String[] args) {
        String userName="admin";
        String passWord="1234567";
        Scanner scanner=new Scanner(System.in);
        for (int i=0; i<3;i++){
            System.out.println("请输入用户名：");
            String name= scanner.next();
            System.out.println("请输入密码：");
            String pwd=scanner.next();
            System.out.println("name="+name);
            System.out.println("pwd="+pwd);
        if (userName.equals(name)&&passWord.equals(pwd))
        {
            System.out.println("恭喜！登陆成功！");
            break;
        }else{
            System.out.println("用户名和密码错误！还剩下"+(2-i)+"次机会");
        }
        }
    }
}
